package com.doc.desensitization.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.doc.desensitization.entity.User;
import com.doc.desensitization.mapper.UserMapper;
import com.doc.desensitization.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Override
    public void addUser(User user) {
        if(user == null){
            throw new RuntimeException("用户信息不能为空");
        }
        this.save(user);
    }

    @Override
    public User getUserInfo(Long id) {
        if(id == null){
            throw new RuntimeException("用户ID不能为空");
        }
        return this.getById(id);
    }

    @Override
    public List<User> listUser() {
        return this.list();
    }
}
